package com.bwie.controller;

import com.bwie.pojo.TimeDiscount;
import com.bwie.service.TimeDiscountService;
import com.bwie.utils.R;
import jdk.nashorn.internal.runtime.regexp.joni.Regex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lenovo
 */
@RestController
@RequestMapping("/timeDiscount")
public class TimeDiscountController {

    @Autowired
    private TimeDiscountService timeDiscountService;

    @PostMapping("/list")
    public R list(){
        List<TimeDiscount> list = timeDiscountService.list();
        return R.OK(list);
    }

    @PostMapping("/save")
    public R save(@RequestBody TimeDiscount timeDiscount){
        boolean save = timeDiscountService.save(timeDiscount);
        return R.OK("添加成功");
    }
}
